package com.mzy.datepackage.M2022.May.teneight;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/5/18 0:20
 * @Version 1.0
 */
public class demo {
    public static void main(String[] args) {
//        String serverPort="";
//        String serverHost="";
//        String[] split = receive.toString().split(",");
//        for (int i = 0; i < split.length; i++) {
//            if (split.length>1){
//                serverPort=split[0];
//            }
//            if (split.length>2){
//                serverHost=split[1];
//            }
//        }
//        System.out.println(serverPort +serverHost);

        String s ="1883,127.0.0.1";

        String serverPort = "";
        String serverHost = "";
        String[] split = s.toString().split(",");
        if (split.length >0 ) {
            serverPort = split[0];
        }
        if (split.length >1 ) {
            serverHost = split[1];
            System.out.println("ip地址" + serverHost);
        }
//
//        for (int i = 0; i < split.length; i++) {
//            System.out.println(split[i]);
//        }
        int i = Integer.parseInt(split[0]);
        System.out.println(i);
        int i2 = Integer.parseInt(serverPort);
        System.out.println(i2);

    }
}
